#ifndef SEGMENTDIFFERENCES_H
#define SEGMENTDIFFERENCES_H

#include <pcl/segmentation/segment_differences.h>
#include <pcl/segmentation/extract_clusters.h>

/*!
 \file segmentDifferences.h This file contains the clustarization functions useful for segment differences.
 \author Sqizzato Stefano
 \author Maroso Alessandro

*/

using namespace std;
using namespace pcl;

/*!
 \brief Finds a vector of clusters in the input cloud

 \param[in] cloud The cloud to search for clusters.
 \param[in] tolerance The cluster tolerance (separate or join adjacent clusters).
 \param[in] min The minimum cluster size.
 \param[in] max The maximum cluster size.
 \return vector<PointIndices> Each element of this vector containg a list of indices representing a cluster of the input cloud.
*/
vector<PointIndices> findClusters(PointCloud<PointXYZRGB>::Ptr cloud,double tolerance, int min, int max);

/*!
 \brief Finds wrong clusters between registered cloud and target cloud using: 1st pass cluster-to-cluster score function; 2nd pass point-to-point difference using PCL built-in function.

 \param[in] registeredCloud The cloud to check.
 \param[in] targetCloud The reference cloud.
 \param[out] diffCloud The output cloud that contains CLUSTERS OF THE TARGET that do not pass one of the two.
 \param[in] scoreThreshold The score threshold for the 1st pass.
 \param[in] distanceThreshold The distance threshold (in mm) for the second pass.
 \return int The number of wrong clusters.
*/
int findWrongClusters(PointCloud<PointXYZRGB>::Ptr registeredCloud ,PointCloud<PointXYZRGB>::Ptr targetCloud, PointCloud<PointXYZRGB>::Ptr diffCloud, float scoreThreshold, float distanceThreshold);

#endif // SEGMENTDIFFERENCES_H
